<template>
    <div class="my-news">
        <ul>
            <li v-for="item in news" @click="goDetail(item.id)" :key="item.id">
                <img :src="item.pic" alt="news-img">
                <p v-html="item.title"></p>
                <span>{{item.descript}}</span>
            </li>
        </ul>
    </div>
</template>

<script>
export default {
    name: 'my-news',
    props: {
        news: Array
    },
    data() { 
        return {

        }
    },
    created() {

    },
    methods:{
        goDetail(id) {
            this.$router.push({
                path: '/detail',
                query: {
                id
                }
            })
        }
    },
}
</script>

<style scoped lang="scss">
.my-news {
    width: 100%;
    overflow-x: auto;
    background-color: #fff;
    ul {
        display: flex;
        li {
            margin-left: 20px;
            font-size: 26px;
            width: 608px;
            flex-shrink: 0;
            padding-bottom: 20px;
            img {
                width: 100%;
                height: 408px;
                border-radius: 18px;
            }
            p {
                margin-top: 24px;
            }
            span {
                display: block;
                width: 466px;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
                margin-top: 30px;
                color: #b2b2b2;
            }
        }
    }
}
</style>